/**
 * @type {Boolean}
 *
 * @properties={typeid:35,uuid:"86FC3471-E597-4CF6-9BB2-B6B1B73518EB",variableType:-4}
 */
var $bok_close = false;

/**
 * @param {JSEvent} event
 *
 * @properties={typeid:24,uuid:"06BED771-BDDC-42D4-AA96-4FE780ADE7B1"}
 */
function btn_aceptar(event) {

	if (forms[controller.getName()]['comprobar_campos'])
		var vbok = forms[controller.getName()]['comprobar_campos']();
		if (vbok == false)
			return null;
	
	$bok_close = true;
	globals.saveFoundset(foundset);
	controller.getWindow().destroy();
	return foundset;
}


/**
 * @param {JSEvent} event
 *
 * @properties={typeid:24,uuid:"BE8FC528-79BB-4A36-835C-4E022A33E8F5"}
 */
function btn_cancelar(event) {

	$bok_close = true;
	globals.cancelEditing();
	controller.getWindow().destroy();
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"29737886-6FB5-447A-BB99-83B1D42BA406"}
 */
function btn_eliminar(event) {
	
	$bok_close = true;
	controller.getWindow().destroy();
}

/**
 * @param {JSEvent} event
 *
 * @properties={typeid:24,uuid:"3BA0A214-B863-4E29-B507-CB0227EC7E36"}
 */
function doEdit(event){
	
	elements.btn_aceptar.visible = true;
	elements.btn_cancelar.visible = true;
	elements.btn_eliminar.visible = false;
	elements.btn_editar.visible = false;
	elements.btn_salir.visible = false;
	globals.doEdit(controller.getName());
}

/**
 * @param {JSEvent} event
 *
 * @properties={typeid:24,uuid:"EE1E08BF-93AF-4EBC-9221-AD879A58F83E"}
 */
function hide_btn_reset_fields(event){
	
	elements.btn_aceptar.visible = false;
	elements.btn_cancelar.visible = false;
	elements.btn_eliminar.visible = true;
	elements.btn_editar.visible = true;
	elements.btn_salir.visible = true;
	globals.hide_btn_reset_fields(controller.getName());
}

/**
 * Handle hide window.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"3C16D0C6-3EFC-4BD9-B65F-E475DF59C001"}
 */
function onHide(event) {

	return $bok_close;
}

